<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/jsp/declare.jsp" %>

<!DOCTYPE html>
<html>
<head>
	<base href="<%=basePath %>" />
	<title>房主订单-列表</title>
	<%@ include file="/common/jsp/common.jsp" %>
	
	<script>
	function confirming(dom) {
		jConfirm("是否确认", function(yes){
			if (!yes)
				return;

			var order = $(dom).parents(".order");
			var orderId = order.attr("id");
			doAjax({
				url: "mvc/master/" + orderId + "/confirm.htm",
				success: function(json){
					if(json) location.reload();
				}
			});
		});
	}
	function cancel(dom) {
		jConfirm("是否取消", function(yes){
			if (!yes)
				return;

			var order = $(dom).parents(".order");
			var orderId = order.attr("id");
			doAjax({
				url: "mvc/master/" + orderId + "/cancel.htm",
				success: function(json){
					if(json) location.reload();
				}
			});
		});
	}
	</script>
</head>
<body id="order" class="bg-grey">
	<div class="title">
		订单管理
	</div>
	<div class="orderList">
		<c:forEach var="order" items="${pagerModel.pageData}">
		<div class="order" id="${order.id }">
			<div class="row">
				<label style="letter-spacing: 6px;">订单号：</label>
				${order.id }
			</div>
			<div class="row">
				<label>订单详情：</label>
				房客${order.grant_name }，${order.detail }
			</div>
			<div class="row">
				<label>订单状态：</label>
				<c:if test="${order.state eq 1 }">
				<font color="#0090FF">待确认</font>
				<button class="confirming" onclick="confirming(this)">确认</button>
				<button class="confirming" onclick="cancel(this)">取消</button>
				</c:if>
				<c:if test="${order.state eq 2 }"><font color="#FF0000">待支付</font></c:if>
				<c:if test="${order.state eq 3 }"><font>已支付</font></c:if>
				<c:if test="${order.state eq 4 }"><font color="#FFBA00">已取消</font></c:if>
			</div>
		</div>
		</c:forEach>
		<form action="" method="post">
		<%@ include file="/common/jsp/paging.jsp" %>
		</form>
	</div>
</body>
</html>